import Router from 'koa-router'

const { videoIdExist, courseIdisExist } = require('../middleware/course_video.middleware')
const { auth } = require('../middleware/auth.middleware')
const { getCourseVideo, getById, addCourseVideo, updateCourseVideo, deleteCourseVideo } = require('../controller/course_video.controller') 
const router = new Router({ prefix: '/course_video' })

/**
 * 课程视频管理模块
 * @description course_video
 */
router.get('/get', getCourseVideo) // 获取所有课程视频(分页可选)
router.get('/get/:id', videoIdExist, getById) // 根据id获取课程视频(分页可选)
router.post('/add', auth, courseIdisExist, addCourseVideo) // 添加课程视频
router.put('/update/:id', auth, videoIdExist, courseIdisExist, updateCourseVideo) // 更新课程视频
router.delete('/delete/:id', auth, videoIdExist, deleteCourseVideo) // 删除课程视频

module.exports = router